import requests

url = 'http://www.baidu.com'

response = requests.get(url=url)

#以字符串形式返回网页源码
print(response.text)
#设置响应编码格式
response.encoding = 'utf-8'
#返回url地址
print(response.url)
#返回二进制数据
print(response.content)
#返回响应状态码
print(response.status_code)
#反会响应头
print(response.headers)